;$(function() {
	var id = $("#id").val();
	getInfo(id);
})

function getInfo(id){
	   $.ajax({
		url: ctxPath+"/supervise/business/findById/" + id,
        type: 'GET',
        success: function(d){
        	var success = d.success;
        	 if(success==true){
        	 var data=  d.data;
        	 if(data!=null){
        		 $("#title").html(data.title);
        		 $("#urgencyDegreeName").html(data.urgencyDegreeName);
        		 $("#remark").html(data.remark);
        		 if(data.files!=null){
           			 var img = "";
           			 var url=ctxPath+"/file/showImage/";
           			 for(var i=0;i<data.files.length;i++){
           				 var temp = url+data.files[i].id;
           				 img+='<li>'
             			+'<a href="'+temp+'">'+data.files[i].srcname
        			    +'</a>'
        			    +'</li>'  ;
           			 }
           	    $("#dropzone").html(img);
           	}	 
		    if(data.supervisionUserList!=null){
            	toShow(data.supervisionUserList);
            }
        	 }
        	}
        }
    });
}


function toShow(data){
	var html=[];
	 var img=ctxPath+'/image/defualt.png';
	$.each(data,function(i,item){
		 if(item.headImage!=null){
			 img=ctxPath+'/file/showImage/'+item.headImage;
		 }
	    var div='<div class="col-sm-2"><img src="'+img+'"  style="max-height: 50px;width=50px;"><br>'
		+'<span>'+item.nickname+'</span><input style="display:none;" id="user_'+item.userId+'" value="'+item.userId+'" name="supervisionUserList['+i+'].userId">'
		+'<input style="display:none;" id="dept_'+item.userId+'" value="'+item.deptId+'" name="supervisionUserList['+i+'].deptId"></div>';
	    html.push(div);
	})
	$("#userList").append(html);
}
/**
 * 获取权限
 * @returns
 */
function getPrmissList(userId){
	if(userId==null||userId==''){
		return;
	}
	$.ajax({
		url: ctxPath+"/set/permission/getPermission/"+userId,
		type: 'GET',
		success: function(d){
			var success = d.success;
			if(success==true){
				if(d.data!=null){
					var result ='';
					$.each(d.data,function(i,item){
						if(item.isCheck){
							result+='<label class="checkbox-inline"><input type="checkbox"  value="'+item.id+'" name="permissionList['+i+'].permissionId" checked disabled="disabled">'+item.menuName+'</label>';	
						}else{
							result+='<label class="checkbox-inline"><input type="checkbox"  value="'+item.id+'" name="permissionList['+i+'].permissionId" disabled="disabled">'+item.menuName+'</label>';	
						}
					})
					$("#modular").html(result);
				}	 
			}
			
		}
	})
}